package cn.hs.lyxf.exception;

import lombok.Data;

/**
 * @Package: cn.mzy.xfcc.exception
 * @ClassName: GlobalCustomizeException
 * @Date:2022/11/17 11:21
 * @Description: 全局自定义异常
 */
@Data
public class GlobalCustomizeException extends RuntimeException {
    // 异常码
    private String code;

    // 无参
    public GlobalCustomizeException() {
        super();
    }

    public GlobalCustomizeException(String message) {
        super(message);
    }

    // 有参
    public GlobalCustomizeException(String message, String code) {
        super(message);
        this.code = code;
    }
    // 拿到异常信息，传给祖宗类，返回一个detailMessage
    public GlobalCustomizeException(GlobalErrorCode globalErrorCode) {
        super(globalErrorCode.getMessage());
        this.code = globalErrorCode.getCode();
    }
}
